<?php

function getQuizzes()
{
    $db = openConnection();  
    $query = "SELECT * FROM all_quizzes;";
    $query = queryDatabase($query, $db);
    return fetchResults($query);
}

function getTypes()
{   
    $db = openConnection();  
    $query = "SELECT * FROM quizz_types;";
    $query = queryDatabase($query, $db);
    return fetchResults($query);
}

function getFilteredContent($type)
{
    $db = openConnection();  
    if ( $type != 'All')
    {
        $query = "SELECT type, name FROM all_quizzes WHERE type='" . $type . "';";
    }
    else
    {
        $query = "SELECT type, name FROM all_quizzes;";
    }
    $query = queryDatabase($query, $db);
    return fetchResults($query);
}

?>